package service.factory;

import service.BookManager;
import service.OrderManager;
import service.UserManager;
import service.impl.BookManagerImpl;
import service.impl.OrderManagerImpl;
import service.impl.UserManagerImpl;
import dao.factory.DaoFactory;

public class ManagerFactory {
	
	private static UserManager userManager;
	private static OrderManager orderManager;
	private static BookManager bookManager;
	
	public static UserManager getUserManagerInstance(){
		if (userManager==null) {
			synchronized (DaoFactory.class) {
				if (userManager==null) {
					userManager = new UserManagerImpl();
				}
			}
		}
		return userManager;
	}
	
	public static BookManager getBookManagerInstance(){
		if (bookManager==null) {
			synchronized (DaoFactory.class) {
				if (bookManager==null) {
					bookManager = new BookManagerImpl();
				}
			}
		}
		return bookManager;
	}
	
	public static OrderManager getOrderManagerInstance(){
		if (orderManager==null) {
			synchronized (DaoFactory.class) {
				if (orderManager==null) {
					orderManager = new OrderManagerImpl();
				}
			}
		}
		return orderManager;
	}

	

}
